package com.zzc.controller;

import com.zzc.common.JsonResult;
import com.zzc.common.TableResult;
import com.zzc.pojo.Customer;
import com.zzc.pojo.Menu;
import com.zzc.service.MenuService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @author zhouzhicheng
 * @version 1.0  2020/12/30
 */
@RequestMapping("/sys/menu")
@RestController
public class MenuController {
    @Autowired
    private MenuService menuService;
    @RequestMapping("/list")
    public TableResult getUserList( Integer page, Integer limit){
        
        return menuService.getMenuList(page,limit);
    }
    @RequestMapping("/del")
    public JsonResult deleteMenuById(Integer[] ids){
        return menuService.deleteMenuById(ids);
    }
    @RequestMapping("/add")
    public JsonResult addMenu(Menu menu){
        return menuService.insertSelective(menu);
    }
    @RequestMapping("/update")
    public JsonResult updateMenu(Menu menu){
        return menuService.updateByPrimaryKeySelective(menu);
    }
    @RequestMapping("/info")
    public Menu getMenuById(Integer id){
        return menuService.getMenuById(id);
    }
    @RequestMapping("/tree")
    public List<Menu> getCustomerName(Integer typeId){
        return menuService.getMenus();
    }
}
